{% extends 'base.html' %}
 
{% block title %}
    博客首页
{% endblock %}
 
{% block content %}
        <div class="container">
        <div class="row">
          <div class="el-col-md-12">
 
              <table class="table">   {# 文章列表 #}
                  <tr class="info">
                      <th>ID</th>
                      <th>标题</th>
                      <th>正文</th>
                      <th>正文</th>
                      <th>时间</th>
                  </tr>
                  {% for article in article_list %}
                      <tr class="active">
                          <td>{{ article.id }}</td>
                          <td><a href="/blog/article_detail/{{ article.id }}/">{{ article.title}}</a></td>
                          <td>{{ article.content|truncatechars:100}}</td>
                          <td>{{ article.created_time}}</td>
                          <td>{{ article.author.username}}</td>
                      </tr>
                  {% endfor %}
              </table>              {# 文章列表结束 #}
 
              <div>                 {# 分页块 #}
                <nav aria-label="Page navigation">
                  <ul class="pagination">
                      {% if article_list_obj.has_previous %}
                        <li>
                           <a href="/blog/?page={{ article_list_obj.previous_page_number }}" aria-label="Previous">
                             <span aria-hidden="true">«</span>
                           </a>
                        </li>
                      {% endif %}
                      {% for number in paginator.page_range %}
                        <li><a href="/blog/?page={{ number }}">{{ number }}</a></li>
                      {% endfor %}
                      {% if article_list_obj.has_next %}
                          <li>
                           <a href="/blog/?page={{ article_list_obj.next_page_number }}" aria-label="Next">
                             <span aria-hidden="true">»</span>
                           </a>
                        </li>
                      {% endif %}
                  </ul>
                </nav>
              </div>   {# 分页块结束 #}
 
 
 
          </div>
        </div>
    </div>
{% endblock %}